[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network.target
Wants=network-online.target
Documentation=https://github.com/coreos

[Service]
Type=notify
EnvironmentFile=-{{ soft.etcd.installPath }}/etcd.conf
ExecStart={{ soft.etcd.installPath }}/etcd \
  --name {{hostname}} \
  --initial-advertise-peer-urls http://{{ ansible_ssh_host }}:{{etcd_peer_tcp_ipv4_port}} \
  --listen-peer-urls http://0.0.0.0:{{etcd_peer_tcp_ipv4_port}} \
  --listen-client-urls http://0.0.0.0:{{etcd_client_tcp_ipv4_port}} \
  --advertise-client-urls http://{{ ansible_ssh_host }}:{{etcd_client_tcp_ipv4_port}} \
  --initial-cluster-token {{initial_cluster_token}} \
  --initial-cluster {% for temphost in etcd_host_list %}{{temphost.name}}=http://{{temphost.ip}}:{{temphost.etcd_peer_tcp_ipv4_port}}{% if not loop.last %},{% endif %}{%  endfor %} \
  --initial-cluster-state new \
  --data-dir={{ soft.etcd.installPath }}/data
# ExecStart={{ soft.etcd.installPath }}/start-etcd-cluster.sh
Restart=on-failure
RestartSec=5
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
